<!-- 预订车位报表 -->
<template>
  <div class="common-body-wrapper">
    <search-header
      single-width="130"
      :searchList="searchList"
      @changeHeight="toRetTable"
      @confirmSearch="toSearch"
      @handleChange="handleSearchChange"
    ></search-header>
    <div class="common-table-tree-wrapper">
      <div class="common-table-wrapper">
        <multi-fun-table
          :sortColumn="notFormatColumn"
          :orderType="sortType"
          :fixed-cols="fixedCols"
          :is-reset-table="isResetTable"
          :theads-info="theadsInfo"
          :tbodys-info="tbodysInfo"
          @handleMultiCheck="handleMultiCheck"
          @handleSortColumn="handleSortColumn"
          @searchFn="getList"
          @getNextPage="getNextPage"
        >
          <div class="operate-btn-group" slot="operateBtnGroup">
            <a
              class="ake_btn ake_btn_text"
              v-if="isPermmited('MGR:SHARE:BOOKING_FORM:EXPORT')"
              @click.prevent="exportData()"
            >导出</a>
          </div>
          <template slot="tdCell" slot-scope="props">
            <el-table-column
              :fixed="props.fixed"
              :label="props.label"
              :min-width="props.minWidth"
              :width="props.width"
              :prop="props.prop"
              :sortable="props.sortable"
            >
              <template slot-scope="scope">
                <span v-if="'reno' == props.prop&&scope.$index!==0">{{ scope.$index }}</span>
                <span v-else-if="'reno' == props.prop&&scope.$index==0">合计</span>
                <span v-else>{{ scope.row[props.prop] }}</span>
              </template>
            </el-table-column>
          </template>
          <!--操作列内的按钮-->
          <template slot="operateCell" slot-scope="props">
            <el-table-column
              v-if="searchList[1].value=='day'"
              :fixed="props.fixed"
              :label="props.label"
              width="88"
              class="operateCell"
            >
              <template slot-scope="scope">
                <el-button
                  size="small"
                  type="primary"
                  icon="icon-info"
                  class="ake-icon-font"
                  title="详情"
                  v-if="scope.$index!==0 && isPermmited('MGR:SHARE:BOOKING_FORM:LIST')"
                  @click="showBookingRecord('bookingRecordModal', scope.row.statDateDisplay)"
                  plain
                ></el-button>
              </template>
            </el-table-column>
          </template>
        </multi-fun-table>

        <table-pagination :size="total" :cur-page="pageNumber" @backData="getPagination"></table-pagination>
      </div>
    </div>
    <!-- 查看详情 modal       -->
    <basic-modal ref="bookingRecordModal" static="true" width="1000">
      <h3 slot="title">预订明细</h3>
      <div class="ModalBody tmpdetailCSS" slot="modal-body">
        <bookingRecord :setData="detailSetData"></bookingRecord>
      </div>
      <div class="modal-footer" slot="modal-footer">
        <button class="ake_btn ake_btn_text modal-close" @click="closed('bookingRecordModal')">关闭</button>
      </div>
    </basic-modal>
  </div>
</template>

<script>
import common from "@mixins/common.js";
import stardardList from "@mixins/tables/stardardList.js";

//modal
import invokeModal from "@mixins/modal/invokeModal.js";
import BigPicModal from "@components/widgets/BigPicModal.vue";

// 引进预订订单流水的组件
import bookingRecord from "./booking_record.vue";

// image
import images from "@mixins/image.js";

// 引进vue的js
import booking_form from "./js/booking_form.js";
export default {
  name: "bookingForm",
  mixins: [common, stardardList, invokeModal, images, booking_form],
  components: {
    BigPicModal,
    bookingRecord
  },
  data() {
    var today = [
      new Date(
        moment()
          .subtract(1, "days")
          .format("YYYY-MM-DD 00:00:00")
      ),
      new Date(
        moment()
          .subtract(1, "days")
          .format("YYYY-MM-DD 23:59:59")
      )
    ]; //昨天
    return {
      fixedCols: 4,
      total: 0,
      detailSetData: {
        fixedCols: 1,
        isShowTableHead: false,
        searchList: []
      },
      searchList: [
        {
          index: 0,
          type: "select",
          isShow: false,
          name: "reportDimension",
          text: "时间维度",
          value: "day",
          isHandleChange: true,
          options: [
            {
              name: "日报",
              value: "day"
            },
            {
              name: "月报",
              value: "month"
            },
            {
              name: "年报",
              value: "year"
            },
            {
              name: "自定义",
              value: "custom"
            }
          ]
        },
        {
          index: 1,
          type: "datePicker",
          pickerType: "daterange",
          isShow: false,
          name: "dateFromTo",
          text: "时间区间",
          format: "yyyy-MM-dd",
          propName: "statDateFromStr,statDateToStr",
          value: today,
          style: {
            width: "360px"
          }
        }
      ],
      theadsInfo: [
        // { index: 0, isShow: false, prop: 'reno', text: '序号', width: 64 },
        {
          index: 0,
          isShow: false,
          prop: "statDateDisplay",
          text: "日期",
          sortable: true,
          minWidth: 80
        },
        {
          index: 1,
          isShow: false,
          prop: "parkName",
          text: "停车场",
          sortable: true,
          minWidth: 60
        },
        {
          index: 2,
          isShow: false,
          prop: "bookingCount",
          text: "预订数量",
          sortable: true,
          minWidth: 50
        },
        {
          index: 3,
          isShow: false,
          prop: "cancelCount",
          text: "取消数量",
          sortable: true,
          minWidth: 50
        },
        {
          index: 4,
          isShow: false,
          prop: "refundCount",
          text: "退款数量",
          sortable: true,
          minWidth: 50
        },
        {
          index: 5,
          isShow: false,
          prop: "serviceFee",
          text: "预订服务费",
          sortable: true,
          minWidth: 50
        },
        {
          index: 6,
          isShow: false,
          prop: "parkingFee",
          text: "预订停车费",
          sortable: true,
          minWidth: 50
        },
        {
          index: 7,
          isShow: false,
          prop: "refundServiceFee",
          text: "预订服务费（退款）",
          sortable: true,
          minWidth: 50
        },
        {
          index: 8,
          isShow: false,
          prop: "refundParkingFee",
          text: "预订停车费（退款）",
          sortable: true,
          minWidth: 50
        },
        {
          index: 9,
          isShow: false,
          prop: "incomeFee",
          text: "收益",
          sortable: true,
          minWidth: 50
        }
      ],
      tbodysInfo: []
    };
  },
  methods: {}
};
</script>

<style lang="less" scoped>
.tmpdetailCSS {
  max-height: 518px;
  overflow: auto;

  .common-body-wrapper {
    position: relative;
  }
}
</style>
